<template>
  <div class="examlist_container  answerlist_container">

    <div class="recordItem">
      <!-- 
      <h5 class="name"> {{examInfo.theme}}</h5>
      <p class="name"> {{examInfo.startTime}}至 {{examInfo.endTime}}</p> -->

      <div class="answerlists" v-for="(item,index) in list" :key="item.id">

        <p>【题目{{index+1}}-- {{getType(item)}}】：{{item.qContent}}</p>
        <div v-if="item.qType==1||item.qType==3||item.qType==4" class="q">
          <p class="corrent">正确答案：{{item.correctAnswers[0]}}</p>
          <p>
            我的答案： {{item.userAnswers[0]}}
          </p>

        </div>
        <div v-if="item.qType==2||item.qType==0" class="q">
          <p class="corrent" v-for="v in item.correctAnswers" :key="v.id">正确答案：{{v}}</p>
          <p v-for="(j,dd) in item.userAnswers" :key="dd">
            我的答案： {{j}}
          </p>
        </div>
      </div>
    </div>

    <div class="step">
      <van-button round type="info" @click="toIndex">返回</van-button>
    </div>
  </div>
</template>
<style scoped>
</style>
<script>
import path from '@/network'
export default {
  name: 'App',
  components: {
  },
  data () {
    return {
      list: [],
    };
  },
  created () {
  },
  mounted () {
    this.recordReport()
  },

  methods: {

    recordReport () {
      path.recordReport({
        examId: this.$route.query.examId,
        recordId: this.$route.query.recordId,
      }).then(res => {
        if (res.success === 0) {
          this.list = res.rows
        }
      })
    },
    getType: function (item) {
      var currExamTypeStr = '';
      if (item.qType == 0) {
        currExamTypeStr = "不定项";
      }
      if (item.qType == 1) {
        currExamTypeStr = "单选题";
      }
      if (item.qType == 2) {
        currExamTypeStr = "多选题";
      }
      if (item.qType == 3) {
        currExamTypeStr = "判断题";
      }
      if (item.qType == 4) {
        currExamTypeStr = "填空题";
      }
      return currExamTypeStr;
    },



    recordlist: function () {
      this.$router.push({ name: 'recordlist', query: { id: this.$route.query.id, } })
    },

    toIndex: function () {
      this.$router.push({ name: 'index' })
    },
  }
}

</script>